Skip to content

Report a plist with an unknown encoding instead of crashing - #79

Merged
Alcides1123 merged 1 commit into
mainfrom
plist-bad-encoding
Nov 12, 2026
Merged

Alcides1123 merged 1 commit into
mainfrom
plist-bad-encoding

Conversation

@Alcides1123

Copy link
Copy Markdown
Owner

Closes #78.

markfind import crashed with a traceback on a property list whose XML declaration names an encoding Python doesn't have. plistlib raises LookupError, which was not among the exceptions parse_safari_plist turns into "not a readable Safari bookmarks file", so it escaped past cmd_import's handler.

Now it is reported like any other unreadable file, with exit code 1.

How I found it

I fuzzed the query path and the parsers, looking for anything that escapes as an unexpected exception:

Surface Inputs Unexpected exceptions
to_fts_query + Store.search, plain and raw ~15,000 query attempts none
extract_text on malformed markup 4,010 none
load_file on mutated bookmark files of every format 944 1
canonical_url on malformed URLs ~90 none

So this was the only hole, and the query path in particular came through clean.

Tests

The bad encoding joins the existing test_corrupt_plist cases, and a new test drives it through markfind import to check it exits 1 with a message rather than a traceback. Re-running the fuzzer afterwards reports nothing unexpected.

413 tests pass, ruff clean.

@Alcides1123
Alcides1123 merged commit e22b3fa into main Nov 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

markfind import crashes on a plist with an unknown encoding

1 participant